{extend name="admin@public/basic" /}
{block name="style"}{/block}
<link rel="stylesheet" href="__STATIC__/css/admin/public.css" media="all"/>
{block name="cotent"}
<form class="layui-form" style="width:80%;">
    <br>
    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">账号名称</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" value="{$user.username|default=''}" readonly>
        </div>
    </div>

    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">修改密码</label>
        <div class="layui-input-block">
            <input type="password" id="password" class="layui-input password" lay-verify="password" lay-verify="required" placeholder="请输入修改密码">
        </div>
    </div>

    <div class="layui-form-item layui-row layui-col-xs12">
        <label class="layui-form-label">确认密码</label>
        <div class="layui-input-block">
            <input type="password" id="password1" class="layui-input password1" lay-verify="password1" lay-verify="required" placeholder="请输入确认密码">
        </div>
    </div>

    <input type="hidden" class="id" id="id" value="{$user.id|default=''}">

    <div class="layui-form-item layui-row layui-col-xs12">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-sm" id="submitBtn">提交</button>
            <button class="layui-btn layui-btn-sm layui-btn-primary" data-close="closeOpen">取消</button>
        </div>
    </div>
</form>
{/block}

{block name="script"}
<script>

    /**
     * 修改
     */
    $("#submitBtn").on("click", function () {
        var data = {
            id: $("#id").val(),
            password: $("#password").val(),
            password1: $("#password1").val(),
        };
        $.request.post("{:url('@admin/user/edit_password')}", data, function (res) {
            $.msg.success(res.msg, function () {
                $.tool.reload('open');
            })
        });
        return false;
    })
</script>
{/block}
